<?php

namespace DesignNew\Flyweight;

/**
 * 然后定义茶店来接单及提供服务
 */
class TeaShop
{
    protected $orders;
    protected $teaMaker;

    public function __construct(TeaMaker $teaMaker)
    {
        $this->teaMaker = $teaMaker;
    }

    public function takeOrder(string $teaType, int $table)
    {
        $this->orders[$table] = $this->teaMaker->make($teaType);
    }

    public function serve()
    {
        foreach($this->orders as $table => $tea)
        {
            echo "Serving tea to table#" . $table;
        }
    }
}

